﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ProjectStore30032013.DAL;

namespace ProjectStore30032013.PRESENTATION
{
    public partial class frmExport : Form
    {
        public frmExport()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void frmExportBefore_Load(object sender, EventArgs e)
        {
            LoadData(); 
        }

        private void LoadData() //Load Data 
        {
            //Load combobox export before
            DataCSQLDataContext db = new DataCSQLDataContext(new Controler().ConnectionString); 

            var _lstOfExportBefore = from d in db.OrderBefores
                                     where d.IsComplete == false
                                     select new { d.OrderBeforeId };

            this.cmbExportBefore.DataSource = _lstOfExportBefore;
            this.cmbExportBefore.DisplayMember = "OrderBeforeId";
            this.cmbExportBefore.ValueMember = "OrderBeforeId";


            //Load cmb ProductId

            var _lstProductId = from d in db.Products
                                select new { d.ProductID, d.ProductName };
            this.cmbProductID.DataSource = _lstProductId;
            this.cmbProductID.DisplayMember = "ProductID";
            this.cmbProductID.ValueMember = "ProductID"; 



            //Load cmb customer 
            var _lstCustomer = from d in db.Customers
                               select new { d.CustomerID };
            this.cmbCustomerID.DataSource = _lstCustomer;
            this.cmbCustomerID.DisplayMember = "CustomerID";
            this.cmbCustomerID.ValueMember = "CustomerID";

            //Load unit
            var _lstUnitMoney = from d in db.UnitMoneys
                           select new { d.UnitMoneyID, d.UnitMoneyName };
            this.cmbUnitMoney.DataSource = _lstUnitMoney;
            this.cmbUnitMoney.DisplayMember = "UnitMoneyName";
            this.cmbUnitMoney.ValueMember = "UnitMoneyID";


        }
    }
}
